package com.sky.mapper;

import com.sky.entity.DishFlavor;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishFlavorMapper {


    /**
     * 批量插入口味数据
     * @param flavors
     */

    void insertBatch(List<DishFlavor> flavors);

    /**
     * 根据菜品dish的id来删除口味表中对应的口味
     * @param dishid
     */
    @Delete("delete from sky_take_out.dish_flavor where dish_id =#{dishid}")
    void deleteById(Long dishid);

    /**
     * 根据菜品dish的ids来删除对应的菜品的口味
     * @param dishids
     */
    void deleteByIds(List<Long> dishids);

    /**
     * 根据菜品dish的id查询对应的口味
     * @param dishId
     * @return
     */
    @Select("select * from sky_take_out.dish_flavor where dish_id =#{dishId}")
    List<DishFlavor> getByDishId(Long dishId);
}
